﻿using SuperSocket.ProtoBase;
using System;
using System.Buffers;
using System.Collections.Generic;
using System.Text;

namespace EDC.DNC.MSAD.NB.HttpClient
{
    internal class HttpBodyPipelineFilter : FixedSizePipelineFilter<HttpRequest>
    {
        readonly HttpRequest _currentRequest;

        public HttpBodyPipelineFilter(int size, HttpRequest request)
            : base(size)
        {
            _currentRequest = request ?? throw new ArgumentNullException(nameof(request));
        }

        protected override HttpRequest DecodePackage(ref ReadOnlySequence<byte> buffer)
        {
            _currentRequest.Body = buffer.CopySequence();

            return _currentRequest;
        }
    }
}
